package com.joysuch.wwyt.core.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joysuch.wwyt.core.bean.BaseUserFaceLogBean;
import com.joysuch.wwyt.core.bean.BaseUserFaceLogReqBean;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.core.service.BaseUserFaceLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xsx
 * @version 1.0
 * @date 2023/3/15 9:14
 */

@Slf4j
@RestController
@RequestMapping("/base/user/faceLog")
@Api(tags = "/base/user/faceLog 人脸识别记录")
public class BaseUserFaceLogController {

    @Autowired
    private BaseUserFaceLogService baseUserFaceLogService;

    /**
     * 查询人脸数据同步日志
     *
     * @param bean
     * @return
     */
    @GetMapping("page")
    @ApiOperation("查询人脸数据同步日志")
    public ResultBean page(BaseUserFaceLogReqBean bean) {
        Page<BaseUserFaceLogBean> page = baseUserFaceLogService.selectPage(bean);
        return ResultBean.pageData(page.getRecords(), page.getTotal());
    }

    @PostMapping("delete")
    @ApiOperation("删除记录")
    public ResultBean delete(Long id) {
        baseUserFaceLogService.delete(id);
        return ResultBean.defaultSuccessResult();
    }
}
